<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
</head>
<body>
  <input type="button" value="按钮" id="btn">

  <script>
    var btn = document.getElementById('btn');
    btn.onclick = function () {
      console.log('别点我，疼');
    }

    // 触发按钮的点击事件
    btn.click();
  </script>
</body>
</html>
